package com.sun.mapper;

import com.sun.pojo.User;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

/**
 * @Author SunBingRui
 * @Date 2020/5/16 23:48
 */
//整合方式一
public class UserMapperImpl implements UserMapper {

    //所有操作使用sqlSessionTemplate执行，
    private SqlSessionTemplate sqlSession;

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }

    public List<User> getUser() {

        UserMapper mapper = sqlSession.getMapper(UserMapper.class);

        List<User> users = mapper.getUser();


        return users;
    }
}
